require "framework/BaseController"
require "FairyGUI"
require "FGUI/BagWindow"

BagMainCtrl = BaseController:New({mControllerName="BagMainCtrl"});

function BagMainCtrl:Awake()
	-- extension loader
	FairyGUI.LuaUIHelper.SetMyLoaderExtension(typeof(MyGLoader));

	local prePackageName = "UI/";
	local packageName = "Bag";
	UIPackage.AddPackage(prePackageName..packageName);

	local componentName = "Main";
	self.mainComponent = UIPackage.CreateObject(packageName, componentName).asCom;
	GRoot.inst:AddChild( self.mainComponent );

	self:OnViewCreated(self.mainComponent);
end
function BagMainCtrl:InitView()
	self.mainComponent:GetChild("bagBtn").onClick:Add(self.OnClickShowPackageBtn, self);
end

function BagMainCtrl:OnClickShowPackageBtn()
	-- body
	local newWindow = BagWindow:New();
	newWindow:Show();
end